package mashuaiproject.mashuaiproject.serivce;

import mashuaiproject.mashuaiproject.mapper.NotificationMapper;
import mashuaiproject.mashuaiproject.model.Notification;
import mashuaiproject.mashuaiproject.model.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NotificationSerivce {

    @Autowired
    private NotificationMapper notificationMapper;

    //通知回复的分页
    public List<Notification> selectCurrentNotified(Integer id,Integer page) {
        //查找出回复·的总数
        Integer size=6;
        Integer offset=size*(page-1);
        List<Notification> notifications=notificationMapper.selectCurrentNotified(id,offset,size);
        return  notifications;
    }

    public Users selectNotifiedUsers(Integer notifier) {
        Users users1=notificationMapper.selectNotifiedUsers1(notifier);
        return  users1;
    }

    public String slectReciverQuesion(Integer quesion_id) {
        String reciverQuesion=notificationMapper.slectReciverQuesion1(quesion_id);
        return  reciverQuesion;
    }

    public String selectReciverComment(Integer comment_id) {
        String ReciverComment=notificationMapper.selectReciverComment1(comment_id);
        return  ReciverComment;
    }

    public Integer selectNoReadCount(Integer id) {
        Integer selectNoReadCount1= notificationMapper.selectNoReadCount(id);
        return  selectNoReadCount1;
    }
}
